home *** CD-ROM | disk | FTP | other *** search
- program CutSize1;
-
- {$R-} { Turn off range checking }
- {$S+} { Turn on Segmentation }
- {$I-} { Turn off I/O error checking }
- {$B+}
- {$R CUTSIZE.RSRC}
- {$T APPLmrak} { Set application ID }
-
- uses Memtypes,QuickDraw,OSIntf,ToolIntf,PackIntf,SANE,PasPrinter;
-
- Const
- Junk = ' ';
- type
- Sections_typ = record
- Name : string[25];
- SecLev : signedbyte;
- Secmod : signedbyte;
- maxlen : integer;
- SecRest : longint;
- SecRestMod : signedbyte;
- Kind : signedByte;
- end;
-
- MessageFile_typ = record
- Location : string[49];
- LowMsg : longint;
- HiMsg : longint;
- SizeMsg : longint;
- Sections : Array[1..255] of Sections_typ;
- end;
-
- Flag_typ = Array[0..7] of Boolean;
-
- Date_typ = record
- Month : Signedbyte;
- Day : Signedbyte;
- Year : Signedbyte;
- Hour : signedbyte;
- Minute : signedbyte;
- Second : signedbyte;
- end;
-
- MsgHdrFile_typ = record
- Status : Signedbyte;
- Reserved : Signedbyte;
- Number : Longint;
- Section : Signedbyte;
- Reserved2 : Signedbyte;
- Delivery : Date_typ;
- From : String[31];
- ToWho : String[31];
- Subject : String[41];
- Network : String[67];
- Offset : Longint;
- MsgSize : Longint;
- ReplyNum : Longint;
- Original : Date_typ;
- end;
-
- var
- Messages : file of MessageFile_Typ;
- Mess : MessageFile_Typ;
- MsgHdr : file of MsgHdrFile_typ;
- Msg : MsgHdrFile_typ;
- Count : Longint;
- Totals : Array[1..255] of Integer;
- Wants : Array[1..255] of Integer;
- Needs : Array[1..255] of Integer;
- Total : Longint;
- Number : Longint;
- Astring : Str255;
- Position : Longint;
- KillLevel : Longint;
- Config : Text;
- OutFile : Text;
- Beginning : Longint;
- DeleteCount : Longint;
- NewTotal : Longint;
- Deleted : Longint;
- MessagesF : str255;
- MsgHdrF : Str255;
- NewsF : Str255;
- OutFileF : Str255;
- LaunchF : Str255;
- TabbyLogF : Str255;
- Today : String[10];
-
- Procedure FindToday;
-
- var
- Today1 : DateTimeRec;
- Temp : Str255;
- Temp1 : Longint;
-
- Begin
- GetTime(Today1);
- Temp1 := Today1.Month;
- NumToString(Temp1,Temp);
- If Length(Temp) = 1 then Temp := Concat('0',Temp);
- Today := Temp;
- Temp1 := Today1.Day;
- NumToString(Temp1,Temp);
- If Length(Temp) = 1 then Temp := Concat('0',Temp);
- Today := Concat(Today,'/',Temp,'/89');
- end;
-
-
- Procedure Launchit (mode : integer;
- fName : STR255);
-
- INLINE
- $204F, $A9F2;
-
- begin
- Reset(Config,'CutSize Config');
- Readln(Config,MessagesF);
- Readln(Config,MsgHdrF);
- Readln(Config,NewsF);
- ReadLn(Config,OutFileF);
- Readln(Config,LaunchF);
- For Count := 1 to 255 do begin
- Readln(Config,Astring);
- StringtoNum(Astring,Number);
- Needs[Count] := Number;
- Totals[Count] := 0;
- Wants[Count] := 0;
- end;
- Close(Config);
- DeleteCount := 0;
- Deleted := 0;
- NewTotal := 0;
- Total := 0;
- KillLevel := 80;
- Reset(Config,NewsF);
- Readln(Config,Astring);
- Close(Config);
- StringtoNum(Astring,Beginning);
- Reset(Messages,MessagesF);
- Read(Messages,Mess);
- Close(Messages);
- FindToday;
- Writeln('___');
- Writeln('|*| CutSize 1.0 - by mark kupferman (1:101/470)');
- Writeln;
- Writeln(Today);
- Writeln;
- Writeln('Scanning Message Base...');
- Writeln;
- ReWrite(OutFile,OutFileF);
- Writeln(Outfile,'CutSize 1.0 - by Mark Kupferman Daily Report of Message Activity for ',Today);
- Writeln(Outfile,'');
-
- Reset(MsgHdr,MsgHdrF);
- Repeat
- Count := Count + 1;
- Read(MsgHdr,Msg);
- If Msg.Status <> 1 then Totals[Msg.Section] := Totals[Msg.Section] + 1;
- If Msg.Status = 1 then Deleted := Deleted + 1;
- total := total + 1;
- If Msg.Number > Beginning then begin
- Wants[Msg.Section] := Wants[Msg.Section] + 1;
- NewTotal := NewTotal + 1;
- end;
- Until eof(MsgHdr);
- Close(MsgHdr);
-
- Writeln(OutFile);
- Writeln(OutFile);
- Writeln(Outfile,'Number of new messages added - by section:');
- Writeln(OutFile);
- For Count := 1 to 255 do begin
- If Wants[Count] <> 0 then Begin
- Writeln(OutFile,Mess.Sections[Count].Name,chr(9),' = ',Wants[Count]);
- end;
- end;
- Writeln(OutFile,'');
- Writeln(Outfile,'Total # of new messages : ',NewTotal);
- Writeln(Outfile,'Total # of messages : ',Total);
- Writeln(Outfile,'Total # of dead messages: ',Deleted);
- Writeln(Outfile);
- Writeln;
- Writeln;
- Writeln('Deleting Overflow Messages...');
- Writeln;
- Writeln(' "S" = Saving Message');
- Writeln(' "D" = Deleting Message');
- Writeln(' "." = Already Deleted Message');
- Writeln;
- For Count := 1 to 255 do begin
- Wants[Count] := 0;
- end;
- Reset(MsgHdr,MsgHdrF);
- Count := 0;
- Repeat
- Count := Count + 1;
- Position := FilePos(Msghdr);
- Read(MsgHdr,Msg);
- If Msg.Status = 1 then Write('.');
- If Msg.Status <> 1 then begin
- If Totals[Msg.Section] <=Needs[Msg.Section] then begin
- Write('S');
- end;
- If Totals[Msg.Section] >Needs[Msg.Section] then begin
- Msg.Status:=1;
- Seek(MsgHdr,Position);
- Write(MsgHdr,Msg);
- Totals[Msg.Section] := Totals[Msg.Section]-1;
- Write('D');
- Wants[Msg.Section] := Wants[Msg.Section]+1;
- DeleteCount:= DeleteCount+1;
- end;
- end;
- Until eof(MsgHdr);
- Close(MsgHdr);
- Writeln;
- Writeln(OutFile);
- Writeln(Outfile,'Number of deleted messages - by section:');
- Writeln(OutFile);
- For Count := 1 to 255 do begin
- If Wants[Count] <> 0 then Begin
- Writeln(OutFile,Mess.Sections[Count].Name,chr(9),' = ',Wants[Count]);
- end;
- end;
- Writeln(OutFile,'');
- Writeln(Outfile,'Total # of deleted messages : ',DeleteCount);
- Writeln(Outfile);
- Writeln(Outfile);
- Writeln(Outfile,'Total number of messages in each base:');
- Writeln(Outfile);
- Writeln;
- For Count := 1 to 255 do begin
- If Mess.Sections[Count].Kind <> 0 then Begin
- Writeln(Outfile,Mess.Sections[Count].Name,chr(9),' = ',Totals[Count]);
- end;
- end;
- Writeln(OutFile);
- Writeln(Outfile);
- Writeln;
- Close(Outfile);
- GetIndString(Astring,0,4);
- Launchit(0,LaunchF);
- end.